<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title><spring:message code="module.oversea.base.title"/></title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#oldPassword").focus();
			$("#inputForm").validate({
				rules: {
				},
				messages: {
					confirmNewPassword: {equalTo: '<spring:message code="oversea.common.label.tips.equalto"/>'}
				},
				submitHandler: function(form){
					loading('<spring:message code="oversea.common.label.tips.loading"/>');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text('<spring:message code="oversea.common.label.tips.error"/>');
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/sys/office/current"><spring:message code="module.oversea.base.title"/></a></li>
		<li><a href="${ctx}/sys/user/info"><spring:message code="module.oversea.base.user.tilte"/></a></li>
		<li><a href="${ctx}/sys/user/modifyPwd"><spring:message code="modele.oversea.base.changepwd"/></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="office" action="${ctx}/sys/office/savecurrent" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>
		<div class="control-group">
			<label class="control-label"><spring:message code="module.oversea.base.company.shortcode"/>:</label>
			<div class="controls">
				<form:input path="code" htmlEscape="false" maxlength="4" class="required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><spring:message code="module.oversea.base.company.name"/>:</label>
			<div class="controls">
				<form:input path="name" htmlEscape="false" maxlength="50" class="required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><spring:message code="module.oversea.base.company.enname"/>:</label>
			<div class="controls">
				<form:input path="enname" htmlEscape="false" maxlength="50"/>
				<span class="help-inline"></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><spring:message code="module.oversea.base.region"/>:</label>
			<div class="controls">
                <sys:treeselect id="area" name="area.id" value="${office.area.id}" labelName="area.name" labelValue="${office.area.name}"
					title="区域" url="/sys/area/treeData" cssClass="required"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><spring:message code="module.oversea.base.company.class"/>:</label>
			<div class="controls">
				<label class="lbl">${fns:getDictLabel(office.category, 'sys_office_cate', '无')}</label>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><spring:message code="module.oversea.base.master.account"/>:</label>
			<div class="controls">
				 <sys:treeselect id="primaryPerson" name="primaryPerson.id" value="${office.primaryPerson.id}" labelName="office.primaryPerson.loginName" labelValue="${office.primaryPerson.loginName}"
					title="用户" url="/sys/office/treeData?type=3" hideBtn="true" disabled="disabled"/>
			</div>
		</div>		
		<div class="control-group">
			<label class="control-label"><spring:message code="module.oversea.base.company.telephone"/>:</label>
			<div class="controls">
				<form:input path="officePhone" htmlEscape="false" maxlength="50" class="required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><spring:message code="module.oversea.base.company.email"/>:</label>
			<div class="controls">
				<form:input path="officeEmail" htmlEscape="false" maxlength="50" class="required"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><spring:message code="module.oversea.base.company.address"/>:</label>
			<div class="controls">
				<form:input path="officeAddress" htmlEscape="false" maxlength="50" class="required"/>
				<span class="help-inline"><font color="red">*</font></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><spring:message code="module.oversea.base.zipcode"/>:</label>
			<div class="controls">
				<form:input path="zipCode" htmlEscape="false" maxlength="50" class="required"/>
				<span class="help-inline"></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><spring:message code="module.oversea.base.worktime"/>:</label>
			<div class="controls">
				<form:input path="workHours" htmlEscape="false" maxlength="50" />
				<span class="help-inline"></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><spring:message code="module.oversea.base.company.site"/>:</label>
			<div class="controls">
				<form:input path="website" htmlEscape="false" maxlength="50" />
				<span class="help-inline"></span>
			</div>
		</div>
		<c:if test="${office.category == 1}">
			<div class="control-group">
				<label class="control-label"><spring:message code="module.oversea.base.longitude"/>:</label>
				<div class="controls">
					<form:input path="longitude" htmlEscape="false" maxlength="50" />
					<span class="help-inline"></span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><spring:message code="module.oversea.base.latitude"/>:</label>
				<div class="controls">
					<form:input path="latitude" htmlEscape="false" maxlength="50" />
					<span class="help-inline"></span>
				</div>
			</div>
		</c:if>				
		<div class="control-group">
			<label class="control-label"><spring:message code="module.oversea.trade.remark"/>:</label>
			<div class="controls">
				<form:textarea path="remarks" htmlEscape="false" rows="3" maxlength="200" class="input-xlarge"/>
			</div>
		</div>
		<div class="form-actions">
			<input id="btnSubmit" class="btn btn-primary" type="submit" value='<spring:message code="oversea.common.button.save"/>'/>
		</div>
	</form:form>
</body>
</html>